package ch12_network.tcp;

import java.io.IOException;
import java.net.Socket;
import java.util.Scanner;

/**
 * TCP Socket通信模型
 *
 * @author guodd
 * @since 1.8
 */
public class TcpClient02 {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("192.168.10.1", 8080);
        Scanner scan = new Scanner(s.getInputStream());
        scan.useDelimiter("\n");
        // 有数据
        if (scan.hasNext()) {
            System.out.println("服务器的回应数据：" + scan.next());
        }
        scan.close();
        s.close();
    }
}
